package com.ordersys.cloud.apis;

import com.ordersys.cloud.domain.R;
import com.ordersys.cloud.entity.ProductDTO;
import com.ordersys.cloud.enums.ReturnCodeEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "cloud-product-service")
public interface ProductFeignApi {

    @PostMapping(value = "/product/add")
    public R  addProduct(@RequestBody ProductDTO product);

    @GetMapping(value = "/product/del/{id}")
    public R deleteProduct(@PathVariable("id") Integer id) ;

    @PostMapping(value = "/product/update")
    public R  updateProduct(@RequestBody ProductDTO productDTO);

    @GetMapping(value = "/product/getProductById/{id}")
    public R<ProductDTO>  getProductById(@PathVariable("id") Integer id);

    @GetMapping("/product/getProductAllList")
    public R  getProductAllList();

    @PostMapping(value = "/product/{productId}/reduceStock")
    public Integer reduceStock(@PathVariable("productId") Integer productId,@RequestParam("quantity") Integer quantity);

}